<style>
    .form-horizontal .control-label { width: 200px; }
    .form-horizontal .form-actions { padding-left: 235px;}
    /*.fix_for_tabs {
        right: 50px;
        top: -11px;
        left:auto
    }*/
</style>
<div class="container">

    <div class="page-header">

        <div class="row">

            <h1 class="span8">
                <?
                    switch ($post_action) {
                        case 'EDIT':
                            echo 'Edit object';
                            break;
                        case 'NEW':
                            echo 'New object';
                            break;

                    }
                ?>
            </h1>

            <span class="span4">

            </span>

        </div>

    </div>

    <form class="form-horizontal" id="editObjectDialog_form" method="post" action="<?=base_url('objects/submit_post')?>" name="editObjectDialog_form">

    <ul class="nav nav-tabs" style="margin-bottom: 0;">

        <li class="active"><a href="javascript:">General</a></li>
        <!--<li class="hidden"><a href="javascript:">Price list</a></li>
        <li class="hidden"><a href="javascript:">Reservations</a></li>  -->
        <li class="hidden"><a href="<?=base_url('objects/view_new_description/apartment')?>">Description</a></li>
        <!--<li class="hidden"><a href="javascript:">Category</a></li>-->

    </ul>

    <div class="row">

        <div class="span12">       

            <input type="hidden" value="<?=$post_action;?>" name="editObjectDialog_post_action" id="editObjectDialog_post_action">    
            <? if($post_action=='EDIT'){?><input type="hidden" value="<?=$object['ID'];?>" name="editObjectDialog_post_ID" id="editObjectDialog_post_ID"><?} ?>

            <div class="group">

                <? $group_id = $this->config->item('general_ID');?>

                <span class="group-title apartment hidden "> GENERAL &nbsp;&nbsp;                            
                    <a id="trgr_addAttr" href="#" title="Add attribute" onclick="addAttributeDialog(base_url+'attributes_to_object/view_new/apartment/<?=$group_id?>'); return false;"><i class="icon-plus"></i> Add attribute</a>&nbsp;&nbsp; 
                    <a id="trgr_editAttr" href="#" title="Edit attribute" onclick="editAttributesDialog(base_url+'attributes_to_object/view_edit/apartment/<?=$group_id?>'); return false;"><i class="icon-wrench"></i> Edit attribute</a>&nbsp;&nbsp; 
                </span>
                <span class="group-title hotel hidden "> GENERAL &nbsp;&nbsp;                            
                    <a href="#" title="Add attribute" onclick="addAttributeDialog(base_url+'attributes_to_object/view_new/hotel/<?=$group_id?>'); return false;"><i class="icon-plus"></i> Add attribute</a>&nbsp;&nbsp; 
                    <a href="#" title="Edit attribute" onclick="editAttributesDialog(base_url+'attributes_to_object/view_edit/hotel/<?=$group_id?>'); return false;"><i class="icon-wrench"></i> Edit attribute</a>&nbsp;&nbsp;
                </span>
                <span class="group-title villa hidden "> GENERAL &nbsp;&nbsp;                            
                    <a href="#" title="Add attribute" onclick="addAttributeDialog(base_url+'attributes_to_object/view_new/villa/<?=$group_id?>'); return false;"><i class="icon-plus"></i> Add attribute</a>&nbsp;&nbsp; 
                    <a href="#" title="Edit attribute" onclick="editAttributesDialog(base_url+'attributes_to_object/view_edit/villa/<?=$group_id?>'); return false;"><i class="icon-wrench"></i> Edit attribute</a>&nbsp;&nbsp;
                </span>

                <fieldset>    

                    <div class="control-group">
                        <label class="control-label">Select type:</label>
                        <div class="controls docs-input-sizes">

                            <select class="span3" name="editObjectDialog_object_type" id="editObjectDialog_object_type">
                                <option value="0">--Please Select</option>
                                <option value="apartment">Apartment</option>
                                <option value="hotel">Hotel</option>
                                <option value="villa">Villa</option>

                            </select>

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label">Select destination:</label>
                        <div class="controls docs-input-sizes">

                            <select class="span3" name="editObjectDialog_destination" id="editObjectDialog_destination">
                                <option value="0">--Please Select</option>
                                <? foreach($destinations as $destination): ?>
                                    <option value="<?=$destination['ID']?>"><?=$destination['post_title'];?></option>
                                    <?
                                        $childrens = $this->objects_model->view_post_children($destination['ID'],'resort');
                                        foreach($childrens as $children): ?>
                                        <option value="<?=$children['ID']?>"><?='-- '.$children['post_title'];?></option>
                                        <? endforeach; ?>
                                    <? endforeach; ?>

                            </select>

                            <a class="btn btn-mini" title="New Destination"><i class="icon-plus"></i></a>

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label">Select suplier:</label>
                        <div class="controls docs-input-sizes">

                            <select class="span2" name="editObjectDialog_owner" id="editObjectDialog_owner">
                                <option value="0">--Please Select</option>
                                <? foreach($owners as $owner): ?>
                                    <option value="<?=$owner['ID']?>"><?=$owner['name'].' '.$owner['surname'];?></option>
                                    <? endforeach; ?>

                            </select>

                            <a class="btn btn-mini" title="New Suplier"><i class="icon-plus"></i></a>
                            <a class="btn btn-mini hide" title="Edit suplier"><i class="icon-wrench"></i></a>

                        </div>
                    </div>

                    <div id="data-container"> </div>

                    <div class="status_info"></div>


                </fieldset>        

            </div>

        </div>

    </div>

    <div class="form-actions">
        <div class="row">
            <span class="span2 save"><button type="submit" class="btn btn-primary" disabled="disabled" id="b-object">Save changes</button></span>
        </div>

    </div>

</div> <!-- /container --> 

<script type="text/javascript"> 

    var postAction = '<?=$post_action?>';

    <?
        switch ($post_action) {

            case 'EDIT':
            ?>
            var editObjectDialog_object_type = '<?=$object['type']?>';
            var editObjectDialog_owner = '<?=$object['owners_ID']?>';
            var editObjectDialog_post_ID = '<?=$object['ID']?>';

            <?
                break;

            case 'NEW':
            ?>
            <?
                break;
        }
    ?>

</script>